package com.nocse.test1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@EnableDiscoveryClient
public class Test1Application {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext config = SpringApplication.run(Test1Application.class, args);
        Environment env = config.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();

        String port = env.getProperty("server.port");
        System.out.println(port);
        System.out.println(ip);
    }

}
